<html>
<head>
  <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
  <title>Contents.m</title>
<link rel="stylesheet" type="text/css" href="../stpr.css">
</head>
<body>
<table  border=0 width="100%" cellpadding=0 cellspacing=0><tr valign="baseline">
<td valign="baseline" class="function"><b class="function">MAHALAN</b>
<td valign="baseline" align="right" class="function"><a href="../probab/index.html" target="mdsdir"><img border = 0 src="../up.gif"></a></table>
  <p><b>Computes Mahalanobis distance.</b></p>
  <hr>
<div class='code'><code>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Synopsis:</span></span><br>
<span class=help>&nbsp;&nbsp;dist&nbsp;=&nbsp;mahalan(X,Mean,Cov)</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Description:</span></span><br>
<span class=help>&nbsp;&nbsp;It&nbsp;computes&nbsp;Mahalanobis&nbsp;distance&nbsp;between&nbsp;column&nbsp;vectors&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;of&nbsp;matrix&nbsp;X&nbsp;and&nbsp;vector&nbsp;Mean&nbsp;with&nbsp;matrix&nbsp;Cov,&nbsp;i.e.,</span><br>
<span class=help></span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;dist(i)&nbsp;=&nbsp;(X(:,i)-Mean)'*inv(C)*(X(:,i)-Mean)</span><br>
<span class=help></span><br>
<span class=help>&nbsp;&nbsp;for&nbsp;all&nbsp;i=1:size(X,2).</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Input:</span></span><br>
<span class=help>&nbsp;&nbsp;X&nbsp;[dim&nbsp;x&nbsp;num_data]&nbsp;Input&nbsp;data.</span><br>
<span class=help>&nbsp;&nbsp;Mean&nbsp;[dim&nbsp;x&nbsp;1]&nbsp;Vector.</span><br>
<span class=help>&nbsp;&nbsp;Cov&nbsp;[dim&nbsp;x&nbsp;dim]&nbsp;Matrix.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Output:</span></span><br>
<span class=help>&nbsp;&nbsp;dist&nbsp;[1&nbsp;x&nbsp;num_data]&nbsp;Mahalanobis&nbsp;distance.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Example:</span></span><br>
<span class=help>&nbsp;&nbsp;It&nbsp;plots&nbsp;isolines&nbsp;of&nbsp;Mahalanobis&nbsp;distance.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;&nbsp;[Ax,Ay]&nbsp;=&nbsp;meshgrid(linspace(-5,5,100),&nbsp;linspace(-5,5,100));</span><br>
<span class=help>&nbsp;&nbsp;dist&nbsp;=&nbsp;mahalan([Ax(:)';Ay(:)'],[0;0],[1&nbsp;0.5;&nbsp;0.5&nbsp;1]);</span><br>
<span class=help>&nbsp;&nbsp;figure;&nbsp;contour(&nbsp;Ax,&nbsp;Ay,&nbsp;reshape(dist,100,100));</span><br>
<span class=help></span><br>
</code></div>
  <hr>
  <b>Source:</b> <a href= "../probab/list/mahalan.html">mahalan.m</a>
  <p><b class="info_field">About: </b>  Statistical Pattern Recognition Toolbox<br>
 (C) 1999-2003, Written by Vojtech Franc and Vaclav Hlavac<br>
 <a href="http://www.cvut.cz">Czech Technical University Prague</a><br>
 <a href="http://www.feld.cvut.cz">Faculty of Electrical Engineering</a><br>
 <a href="http://cmp.felk.cvut.cz">Center for Machine Perception</a><br>

  <p><b class="info_field">Modifications: </b> <br>
 28-apr-2004, VF<br>

</body>
</html>
